<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>驾驶员考试预约系统</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description"
	content="Charisma, a fully featured, responsive, HTML5, Bootstrap admin template.">
<meta name="author" content="Muhammad Usman">

<!-- The styles -->
<link
	href="<%=request.getContextPath()%>/resources/css/bootstrap-cerulean.min.css"
	rel="stylesheet">
<link
	href="<%=request.getContextPath()%>/resources/css/charisma-app.css"
	rel="stylesheet">
<link
	href='<%=request.getContextPath()%>/resources/bower_components/fullcalendar/dist/fullcalendar.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/bower_components/fullcalendar/dist/fullcalendar.print.css'
	rel='stylesheet' media='print'>
<link
	href='<%=request.getContextPath()%>/resources/bower_components/chosen/chosen.min.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/bower_components/colorbox/example3/colorbox.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/bower_components/responsive-tables/responsive-tables.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/bower_components/bootstrap-tour/build/css/bootstrap-tour.min.css'
	rel='stylesheet'>
<link href='<%=request.getContextPath()%>/resources/css/jquery.noty.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/css/noty_theme_default.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/css/elfinder.min.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/css/elfinder.theme.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/css/jquery.iphone.toggle.css'
	rel='stylesheet'>
<link href='<%=request.getContextPath()%>/resources/css/uploadify.css'
	rel='stylesheet'>
<link href='<%=request.getContextPath()%>/resources/css/animate.min.css'
	rel='stylesheet'>

<!-- jQuery -->
<script
	src="<%=request.getContextPath()%>/resources/bower_components/jquery/jquery.min.js"></script>

<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

<!-- The fav icon -->
<link rel="shortcut icon"
	href="<%=request.getContextPath()%>/resources/img/favicon.ico">
<script type="text/javascript"
	src="<%=request.getContextPath()%>/dwr/engine.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/dwr/interface/dwrService.js"></script>
<script type="text/javascript">
	function orderCheck(testPlace,formId) {
		if (testPlace === 'null' || testPlace === '') {
			$("#"+formId).submit();
		} else {
			alert("已安排考场，请先取消预约");
		}
	}
</script>
</head>
<body>
	<jsp:include page="../toolbar.jsp"></jsp:include>
	<div class="ch-container">
		<div class="row">
			<jsp:include page="../nav.jsp"></jsp:include>
			<div id="content" class="col-lg-10 col-sm-10">

				<table class="table">
					<thead>
						<tr>
							<th>科目名称</th>
							<th>预约状态</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${testTypes }" var="tt">
							<tr>
								<td id="name${tt.id }">${tt.name }</td>
								<td><c:choose>
										<c:when test="${tt.id ==user.ttid }">
											<span style="color: green">已预约</span>
										</c:when>
										<c:otherwise>
											<span style="color: red">未预约</span>
										</c:otherwise>
									</c:choose></td>
								<td><c:choose>
										<c:when test="${tt.id ==user.ttid }">
											<form
												action="<%=request.getContextPath()%>/student/delTestType"
												method="post">
												<input type="submit" value="取消预约" class="btn btn-success" />
											</form>
										</c:when>
										<c:otherwise>
											<form id="order-form${tt.id }"
												action="<%=request.getContextPath()%>/student/addTestType"
												method="post">
												<input type="hidden" name="tid" value="${tt.id }" /> <input
													type="hidden" name="testType" value="${tt.name }" /> <input
													type="button"
													onclick="orderCheck('${user.studentMes.testPlace}','order-form${tt.id }')"
													value="预约考试" class="btn btn-danger" />
											</form>
										</c:otherwise>
									</c:choose></td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
		</div>
	</div>
	<jsp:include page="../foot.jsp"></jsp:include>
</body>
</html>